<%@ page language="java"   
    import ="com.jju.A1541.model.*"
    import ="com.jju.A1541.dao.*"
    contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%
       //1.获得表单的输入
       String uname = request.getParameter("uname");
       String sex = request.getParameter("sex");
       String ejxy = request.getParameter("ejxy");
       String grjj = request.getParameter("grjj");
       String username = (String)session.getAttribute("u");
       
       uname = new String(uname.getBytes("ISO-8859-1"),"UTF-8");
       sex= new String(sex.getBytes("ISO-8859-1"),"UTF-8");
       ejxy= new String(ejxy.getBytes("ISO-8859-1"),"UTF-8");
       grjj= new String(grjj.getBytes("ISO-8859-1"),"UTF-8");
       
       //2.创建User1实体类User1对象并进行赋值
         User1  obj = new 	User1();
         obj.setUname(uname);
         obj.setSex(sex);
         obj.setEjxy(ejxy);
         obj.setGrjj(grjj);
         obj.setUsername(username);
       //3.调用User1DAO完成实体对象的持久化--保存到数据库表中
       int n = User1DAO.add(obj);
       
       //4..对结果的处理
        if(n>0){
        	  request.getSession().setAttribute("uname", uname);
        	  request.getSession().setAttribute("ejxy", ejxy);
        	  out.print("<script>alert('保存成功！'); window.location='products.jsp'  </script>");
        }else{
        	   out.println("保存失败!");
        }
       %>